# -*- coding : utf_8 -*-
'''
=======================================
Time : 2025/3/14 0:35
Author : 田霄汉
Email : 522989570@qq.com
File : dict_util.py
Project : pytest_demo
=======================================
'''

def get_min_values(dict_data, result=None):
    """
    获取最小级别的values
    :param dict_data: 源字典数据
    :return: 返回字典数据中的全部values
    """
    try:
        if result is None:
            result = []
        for values in dict_data.values():
            if isinstance(values, dict):
                get_all_values(values, result)
            else:
                result.append(values)
        return result
    except Exception as E:
        print(E)

def get_min_keys(dict_data, result=None):
    """
    获取最小级别的keys
    :param dict_data: 源字典数据
    :return: 返回字典数据中的全部keys
    """
    try:
        if result is None:
            result = []
        for keys, values in dict_data.items():
            if isinstance(values, dict):
                get_min_keys(values, result)
            else:
                result.append(keys)
        return result
    except Exception as E:
        print(E)

def get_all_values(dict_data, result=None):
    """
    获取全部的values
    :param dict_data: 源字典数据
    :return: 返回字典数据中的全部values
    """
    try:
        if result is None:
            result = []
        for values in dict_data.values():
            result.append(values)
            if isinstance(values, dict):
                get_all_values(values, result)
        return result
    except Exception as E:
        print(E)

def get_all_keys(dict_data, result=None):
    """
    获取全部的keys
    :param dict_data: 源字典数据
    :return: 返回字典数据中的全部keys
    """
    try:
        if result is None:
            result = []
        for keys, values in dict_data.items():
            result.append(keys)
            if isinstance(values, dict):
                get_all_keys(values, result)
        return result
    except Exception as E:
        print(E)